import {request} from './request';

export function getHomeAuction(id) {
  return request({
    url: '/auction/',
    params: {
      'page': id
    }
  })
}

export function DeleteHomeAuction(auction_id, iid = '') {
  return request({
    url: '/auction/delete/' + iid,
    method: "post",
    data: {
      auction_id
    }
  })

}


export function AddHomeAuction(content) {
  return request({
    url: '/auction/add/',
    method: "post",
    data: {
      content
    }
  })
}

export function TX_COS() {
  return request({
    url: "/credential/",
    method: "get"
  })

}

export function AddHomeAuctionItem(content, id) {
  return request({
    url: '/auction/add/' + id + '/',
    method: "post",
    data: {
      content
    }
  })
}

export function getHomeAuctionItem(id) {
  return request({
    url: '/auction/item/' + id + '/',
    method: "get",
  })
}

export function getHomeAuctionItemImg(id) {
  return request({
    url: '/auction/item/img/' + id + '/',
    method: "get",
  })
}

export function AddHomeAuctionItemImg(item) {
  return request({
    url: '/auction/item/img/' + item.item_id + '/',
    method: "post",
    data: {
      ...item
    }
  })
}

export function DeleteAuctionItemImg(pk, iid) {
  return request({
    url: '/auction/item/delete/' + pk,
    method: "get",
    params: {
      iid
    }
  })

}

export function getHomeAuctionDetailItem(data) {
  return request({
    url: '/auction/item/detail/',
    method: "post",
    data: {
      ...data
    }
  })

}

export function getAuctionCoupon(aid, methods, coupon) {
  return request({
    url: '/coupon/' + aid + '/',
    method: methods,
    data: coupon
  })
}


export function getAuctionCouponDelete(cid) {
  return request({
    url: '/coupon/delete/' + cid + '/',
    method: "get"
  })
}

export function getAuctionCouponEdit(coupon) {
  return request({
    url: '/coupon/edit/' + coupon.id + '/',
    method: "post",
    data: {
      coupon
    }
  })
}



